package cn.org.eshow.webapp.action.response;

import cn.org.eshow.model.Notification;

import java.util.Date;

/**
 * 消息通知返回对象
 */
public class NotificationResponse {

    private Integer id;// 消息通知ID
    private Date addTime; //添加时间
    private Date updateTime; //更新时间
    private String category;//分类（系统消息，平台公告）
    private String img;//图片
    private String title;//标题
    private String content;//内容
    private String model;//模型
    private String modelVal;//模型值
    private Integer state;//状态（1已读，0未读）
    private UserSimpleResponse user;//用户

    public NotificationResponse() {
    }

    public NotificationResponse(Notification notification) {
        this.id = notification.getId();
        this.addTime = notification.getAddTime();
        this.updateTime = notification.getUpdateTime();
        this.category = notification.getCategory() == null ? "" : notification.getCategory();
        this.img = notification.getImg() == null ? "" : notification.getImg();
        this.title = notification.getTitle() == null ? "" : notification.getTitle();
        this.content = notification.getContent() == null ? "" : notification.getContent();
        this.model = notification.getModel() == null ? "" : notification.getModel();
        this.modelVal = notification.getModelVal() == null ? "" : notification.getModelVal();
        this.state = notification.getState();
        if (notification.getUser() != null) {
            this.user = new UserSimpleResponse(notification.getUser());
        }
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getModelVal() {
        return modelVal;
    }

    public void setModelVal(String modelVal) {
        this.modelVal = modelVal;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public UserSimpleResponse getUser() {
        return user;
    }

    public void setUser(UserSimpleResponse user) {
        this.user = user;
    }
}
